package android.group.one;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class result extends Activity  {

	TextView correct_answer;
	TextView time;
	TextView score;
	TextView status;
	TextView grade;
	Button review;
	Button try_again;
	Button main_page;
	
	public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.result);
        
        correct_answer = (EditText) findViewById(R.id.result_correct_answer);
        time = (EditText) findViewById(R.id.result_time);
        score = (EditText) findViewById(R.id.result_score);
        status = (EditText) findViewById(R.id.result_status);
        grade = (EditText) findViewById(R.id.result_grade);
        review = (Button) findViewById(R.id.result_review);
        try_again = (Button) findViewById(R.id.result_try_again);
        main_page = (Button) findViewById(R.id.result_mainpage);
        init();
	}
	
	public void init(){
		Bundle extra = getIntent().getExtras();
		if(extra != null){
			correct_answer.setText("correct answer" + extra.getString("correct_answer").toString()+"%");
			float temp = new Float(extra.getString("result").toString());
			if(temp >= 90){
				grade.setText("A");
			} else if (temp >= 80){
				grade.setText("B");
			} else if (temp >= 70){
				grade.setText("C");
			} else if (temp >= 60){
				grade.setText("D");
			} else {
				grade.setText("F");
			}
			time.setText(extra.getString("time").toString());
			score.setText("score" + extra.getString("result").toString()+"%");
			if(temp >= 70){
				status.setText("PASS");
			} else {
				status.setText("FALSE");
			}
		}
		
		
	}
}
